/*
 * Copyright 2007-2009 Perttu "celeron55" Ahola <celeron55@gmail.com>
 *
 * This file is part of jukumagic.
 *
 * jukumagic is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * jukumagic is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with jukumagic.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef PIN_H_
#define PIN_H_

#include "common.h"
#include "jukuobject.h"
#include "boardpoint.h"

enum PinType
{
	PIN_THROUGH_HOLE,
	PIN_THROUGH_HOLE_INVISIBLE,
};

class Component;

class Pin : public JukuObject
{
public:
	wxString m_num;
	wxString m_name;
	PinType m_type;
	int m_x, m_y;
	int m_mark;
	Pin();
	Pin(Pin &pin);
	~Pin();
    JukuObjectType GetType(){ return TYPE_PIN; }
	const wxChar * GetShortString(void){return NULL;}
	const wxChar * GetTypeString(void){return _("Pin");}
 	JukuObject* MakeACopy();
	void WriteXML(TiXmlNode* root);
	static JukuObject* ReadFromXMLElement(TiXmlElement* element);
	void Draw(wxDC &dc, wxWindow *window, wxPoint origin);
	BoardRect GetDrawArea();
	
	void Move(int dx, int dy);

	void Rotate(TurnDirection dir, BoardPoint origin);

	//

	Component* GetComponent();
	BoardPoint GetComponentPinPosition();
};

#endif
